<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title>超时未报价</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link rel="stylesheet" href="/lib/layui/css/layui.css">
    <link rel="stylesheet" href="/static/css/weadmin.css">
    <!-- 注意：如果你直接复制所有代码到本地，上述css路径需要改成你本地的 -->
</head>
<body>

<form class="layui-form searchForm" action="">
    查询:
    <div class="layui-input-inline">
        <input style="width:200px;" type="text" name="prjName" placeholder="项目名称/申报编号" autocomplete="off"
               class="layui-input">
    </div>
    <button class="layui-btn" lay-submit lay-filter="formDemo">查询</button>
    <button class="layui-btn" lay-submit lay-filter="formClear">清空</button>
</form>
<table class="layui-hide" id="dataList" lay-filter="dataList"></table>
<script type="text/html" id="barDemo">
    <a class="layui-btn layui-btn-primary layui-btn-xs" lay-event="detail">详情</a>
    <a class="layui-btn layui-btn-xs" lay-event="result">中标结果</a>
</script>

<script type="text/javascript" src="/lib/layui/layui.js"></script>
<script src="/static/js/main.js"></script>
<script>
    layui.use(['jquery', 'configureCom', 'configure', 'table', 'sessionFun'], function () {
        var $ = layui.jquery;
        var configure = layui.configure;
        var matchDict = layui.matchDict;
        var table = layui.table;
        var sessionFun = layui.sessionFun;
        var configureCom = layui.configureCom;

        var cols = [[
            {
                field: 'prjName', title: '建设项目名称', templet: function (d) {
                    return '<p>' + d.prjName + '</p><p>申报编号:' + (d.declareCode || '-') + '</p>';
                }
            },
            {field: 'prjCategory', title: '工程专业类别', templet: function (d) {
                    return '<p>' + (matchDict.name(d.prjCategory,configure.PRJ_CATEGORY) || '-') + '</p>';
                }
            },
            {
                field: '', title: '报价上限', templet: function (d) {
                    return '<p>施工图审查:' + (d.selectSjCost || '-') + '元</p><p>勘察审查:' + (d.selectKcCost || '-') + '元</p>';
                }
            },
            {
                field: '', title: '审查时限', templet: function (d) {
                    return '<p>施工图审查:' + (d.sjDay || '-') + '天</p><p>勘察审查:' + (d.kcDay || '-') + '天</p>';
                }
            },
            {
                field: '', title: '报价', templet: function (d) {
                    return '<p>施工图审查:' + (d.sjCost || '-') + '元</p><p>勘察审查:' + (d.kcCost || '-') + '元</p>';
                }
            },
            {fixed: 'right', title: '操作', toolbar: '#barDemo', width: 180}
        ]];
        configureCom.tableRender(configure.EXAMINE_PRICE_TIMEOUT_PRICE_LIST_HTTP, {}, cols, 'dataList', 10, 'full-60');

        //每行操作
        table.on('tool(dataList)', function (obj) {
            var data = obj.data;
            sessionFun.set(configure.SESSION_PROJECT_LIST_DATA, data);
            if (obj.event === 'detail') {//查看详情
                editItem('详情', configure.EXAMINE_DETAILED_HTML);
            } else if(obj.event === 'result'){
                editItemsl('中标结果', configure.EXAMINE_PRICE_SELECTED_RESULT_HTTP);
            }
        });
        //查看详情
        function editItem(title, url) {
            top.layer.open({
                type: 2,
                title: title,
                area: configureCom.Psize1,
                content: configureCom.nocache(configure.EXAMINE_DETAILED_HTML),
                success: function (layero, index) {
                    top.layer.full(index);
                }
            });
        }
        //查看报价
        function editItems(title, url) {
            top.layer.open({
                type: 2,
                title: title,
                area: configureCom.Psize1,
                btnAlign: 'c',
                content: configureCom.nocache(configure.EXAMINE_QUOTED_HTML),
                btn: ['提交报价','取消'],
                yes: function (index, layero) {
                    var iframeWin = top.window.frames['layui-layer-iframe' + index]; //得到iframe页的窗口对
                    var data = iframeWin.getData().then(function (res) {
                        var kcCost = res.result.kcCost +'.00'
                        var sjCost = res.result.sjCost +'.00'
                        if(parseInt(kcCost) > parseInt(listData.selectKcCost)){
                            top.layer.msg("勘察审查费用不能超过上限!")
                        }else if(parseInt(sjCost) > parseInt(listData.selectSjCost)){
                            top.layer.msg("施工图审查费用不能超过上限!")
                        }else {
                            configureCom.postDataAjax(url, res.result).then(function (res) {
                                console.log(res);
                                top.layer.close(index);
                                top.layer.msg('提交成功！');
                                configureCom.postDataAjax(configure.EXAMINE_API_PROCESS_COMPLETE_LIST_HTTP);
                                configureCom.tableReload(true);
                            });
                        }
                    });
                },
            });
        }
        //中标结果
        function editItemsl(title, url) {
            top.layer.open({
                type: 2,
                title: title,
                area: configureCom.Psize1,
                btnAlign: 'c',
                content: configureCom.nocache(configure.EXAMINE_RESULT_HTML),
                btn: ['关闭'],
            });
        }
        //监听搜索
        configureCom.tabSearch(configure.EXAMINE_PRICE_ALREADY_PRICE_LIST_HTTP, {}, cols);
    });

</script>



</body>
</html>